<input type="hidden" name="parse" value="0">
<script type="text/javascript" charset="utf-8" src="__STATIC__/global/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/global/ueditor/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/global/ueditor/lang/zh-cn/zh-cn.js"></script>

<script type="text/javascript"> 
    var {$data.name}_Editor;
    var height = "{$data.height}";
    var width = '';
    if(height == "")
            height = 350;
    if(width == "")
            width = 980;
    var bars = [{$data.toolbars}];
    if (bars.length == 0)
            bars = [
                ['fullscreen', 'source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'lineheight'],
                // ['paragraph', 'fontfamily', 'fontsize', 'indent', 'justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'insertimage', 'emotion', 'attachment', 'template', 'map']
                ['paragraph', 'fontfamily', 'fontsize', 'indent', 'justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'insertimage', 'emotion', 'template', 'map']
            ];
    {empty name="data.id"}
        $("textarea[name='{$data.name}']").attr("data-editor", "{$data.name}_Editor");
        {$data.name}_Editor = UE.getEditor('{$data.name}', {
            serverUrl: getURL("editor/uedit",'','editor'),
            toolbars: bars,
            wordCount: false,
            autoHeightEnabled: false,
            autoFloatEnabled: true,
            initialFrameWidth: width,
            initialFrameHeight: height
        });
        {$data.name}_Editor.addListener("beforeInsertImage", function(e, data){
        //添加图片回调
            if(typeof(insertImageCallback) == 'function'){
                insertImageCallback(data);
            }
        });
    {/empty}


        
    function onLoadSuccess(data){
        $("textarea[name='{$data.name}']").attr("data-editor", "{$data.name}_Editor");
        {$data.name}_Editor = UE.getEditor('{$data.name}', {
            serverUrl: getURL("editor/uedit",'','editor'),
            toolbars: bars,
            wordCount: false,
            autoHeightEnabled: false,
            autoFloatEnabled: true,
            initialFrameWidth: width,
            initialFrameHeight: height
        });

        {$data.name}_Editor.addListener("beforeInsertImage", function(e, data){
        //添加图片回调
            if(typeof(insertImageCallback) == 'function'){
                insertImageCallback(data);
            }
        });
    }
    
  

    
</script>